//
//  INeedToCatchUpViewController.m
//  PlayerWorld
//
//  Created by 1 on 16/5/16.
//  Copyright © 2016年 刘成. All rights reserved.
//
#define UISCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#import "INeedToCatchUpViewController.h"

@interface INeedToCatchUpViewController ()

@end

@implementation INeedToCatchUpViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我要追号";
    self.view.backgroundColor = [UIColor redColor];
    
    self.iNeedToCatchUptitles1 = @[@"追号期数",@"总期数",@"追号总金额"];
    self.iNeedToCatchUptitles2 = @[@"起始倍数",@"最低收益率",@"追号期数"];

    iNeedToCatchUptableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT) style:UITableViewStylePlain];
    iNeedToCatchUptableView.dataSource = self;
    iNeedToCatchUptableView.delegate = self;
    iNeedToCatchUptableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.view addSubview:iNeedToCatchUptableView];

}

//设置表视图中的行数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 3;
    }else if(section == 1){
        return 3;
    }else if(section == 2){
        return 4;
    }else{
        return 1;
    }
}
//设置表视图中的section（分组）数,默认为1
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 4;
}

// 设置header的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section < 3) {
        return 20;
    }else{
        return 40;
    }
    
    
}

- (CGFloat)tableView:(UITableView *)atableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 35;
}



//设置单元格中的数据
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdent = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdent];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdent];
        cell.backgroundColor = [UIColor whiteColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.textLabel.font = [UIFont systemFontOfSize:14];
        
    }
    
    //设置数据
    if (indexPath.section == 0) {
        cell.textLabel.text = _iNeedToCatchUptitles1[indexPath.row];
    }else if (indexPath.section == 1) {
        cell.textLabel.text = _iNeedToCatchUptitles2[indexPath.row];
        
    }else if (indexPath.section == 3){
        cell.textLabel.text = @"生成追号单";
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
        cell.textLabel.textColor = [UIColor whiteColor];
        cell.backgroundColor = [UIColor colorWithRed:48/255.0f green:173/255.0f blue:224/255.0f alpha:1];
    }
    return cell;
    
}


@end
